import request from '@/utils/request'

// 获取参考素材列表
export function getReferences(treeId) {
  return request({
    url: '/cms/api/references/',
    method: 'get',
    params: { tree_id: treeId }
  })
}

// 获取单个参考素材
export function getReference(id) {
  return request({
    url: `/cms/api/references/${id}/`,
    method: 'get'
  })
}

// 添加参考素材
export function addReference(data) {
  return request({
    url: '/cms/api/references/',
    method: 'post',
    data: data
  })
}

// 更新参考素材
export function updateReference(id, data) {
  return request({
    url: `/cms/api/references/${id}/`,
    method: 'put',
    data: data
  })
}

// 删除参考素材
export function deleteReference(id) {
  return request({
    url: `/cms/api/references/${id}/`,
    method: 'delete'
  })
}

// 批量操作参考素材
export function batchReferences(data) {
  return request({
    url: '/cms/api/references/batch/',
    method: 'post',
    data: data
  })
}
